package com.yc.qunxing.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yc.qunxing.entity.UserRatings;
import com.yc.qunxing.entity.Users;
import com.yc.qunxing.mapper.UserRatingsMapper;
import com.yc.qunxing.service.IUserRatingsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 鹏哥
 * @since 2024-05-23
 */
@Service
public class UserRatingsServiceImpl extends ServiceImpl<UserRatingsMapper, UserRatings> implements IUserRatingsService {

    @Autowired
    UserRatingsMapper userRatingsMapper;
    @Override
    public List<UserRatings> getUserRatingsByManager(String keyword, String keywordOrder) {
        QueryWrapper<UserRatings> queryWrapper=new QueryWrapper();
        if(keyword!=null && !keyword.isEmpty()){
            queryWrapper.and(wrapper-> wrapper
                    .like("order_id", keyword));
        }
        if (keywordOrder != null && !keywordOrder.isEmpty()) {
            queryWrapper.like("status", keywordOrder);
        }
        queryWrapper.orderByDesc("last_updated");
        return userRatingsMapper.selectList(queryWrapper);
    }
}
